<template>
    <div class="goodsRouter-container">
        <div class="goodsList">
            <form class="mui-input-group" >
                <div class="mui-input-row mui-checkbox mui-left" v-for="(item,i) in carGoods" :key="item.id">
                    <div class="mui-card" >
                        <div class="mui-card-content">
                            <div class="mui-card-content-inner">
                                <img :src=item.src alt="">
                                <div class="info">
                                    <h1>{{item.name}}</h1>
                                    <p>
                                        <span class="price">￥{{item.price}}</span>
                                        <numbox :initcount="$store.getters.getGoodsCount[item.id] " :id = 'item.id'></numbox>
                                        <a href="#" @click.prevent="remove(item.id,i)">删除</a>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>
                    <input name="checkbox1" type="checkbox">
                </div>
            </form>
            <!--v-model="$store.getters.getSelected[item.id]"-->
        </div>
        <div class="mui-card zongJi">
            <div class="mui-card-content">
                <div class="mui-card-content-inner jieSuan">
                    <div class="left">
                        <p>总计（不含运费）</p>
                        <p>已勾选商品：<span>0</span> 件，共计：￥<span>0</span></p>
                    </div>
                    <div class="right">
                        <mt-button type="danger">结算</mt-button>
                    </div>

                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import numbox from '../subComponents/goodsR_numbox.vue';

    export default {
        data(){
            return {
                value:'',
                arr:[],
                carGoods:[
                    {id:0,name:'小米 红米Redmi Note7',price:999,src:'https://m.360buyimg.com/babel/jfs/t30184/230/476184793/260944/53cc2bbc/5bf4b25dN3b673c83.jpg!q70.jpg'},
                    {id:1,name:'华为 红米Redmi Note7',price:1999,src:'https://m.360buyimg.com/babel/jfs/t1/11183/35/3943/371763/5c236b2dE87724d33/81b70b161bb2e061.jpg!q70.jpg'},
                    {id:2,name:'苹果 红米Redmi Note7',price:2999,src:'https://img14.360buyimg.com/n2/jfs/t19780/222/1897536104/310145/ffa04ad5/5add75c8N45d76e9a.jpg!q80.webp'}]
            }

        },
        methods:{
            remove(id,index){
                this.carGoods.splice(index,1);
                this.$store.commit('removeGoods',id)
            }
        },
        components: {
            numbox
        }
    }
</script>

<style lang="less" scoped>
    .goodsRouter-container {
        .goodsList {
            form{
                background-color: #eee;
                overflow: hidden;
                height: 100vh;
                margin-bottom: 105px;
            }
            .mui-card-content-inner {
                display: flex;
                align-items: center;
                margin-left: 50px;
                .mui-input-group {
                    margin-left: -20px;
                    background-color: transparent;
                }
            }
            .mui-checkbox.mui-left input[type=checkbox] {
                top: 39px;
            }
            .mui-input-group .mui-input-row:after {
                height: 0;
            }

            img {
                width: 60px;
                height: 60px;
                margin-left: -15px;
            }

            h1 {
                font-size: 13px;
            }

            .info {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                p {
                    margin-top: 3px;
                    .price {
                        color: red;
                        font-weight: 700;
                        width: 53px;
                        display: inline-block;
                    }

                    .mui-numbox {
                        height: 27px;
                        margin-right: 5px;
                        float: none;
                    }
                }
            }
            .mui-input-group .mui-input-row {
                 height: auto;
            }
        }


        .zongJi {
            margin: 0;
            position: fixed;
            bottom: 55px;
            width: 100%;
            .jieSuan {
                display: flex;
                justify-content: space-between;
                align-items: center;
                span{
                    color: red;
                    font-weight: 700;
                    font-size: 16px;
                }
            }
        }

    }

</style>